import request from '@/utils/request'

const bidRulesShared = {
  state: {
    sharedMethods: {}
  },
  mutations: {
    registerBiddingEndMethod(state, { key, method }) {
      state.sharedMethods[key] = method
    }
  }
}
export default bidRulesShared

export function listBidRules(query) {
  return request({
    url: '/bidding/bidTenderRules/list',
    method: 'get',
    params: query
  })
}

export function getBidRules(id) {
  return request({
    url: '/bidding/bidTenderRules/' + id,
    method: 'get'
  })
}

export function addBidRules(data) {
  return request({
    url: '/bidding/bidTenderRules',
    method: 'post',
    data: data
  })
}

export function updateBidRules(data) {
  return request({
    url: '/bidding/bidTenderRules',
    method: 'put',
    data: data
  })
}

export function delBidRules(id) {
  return request({
    url: '/bidding/bidTenderRules/' + id,
    method: 'delete'
  })
}


//查询竞标规则
export function findBiddingRuleBySid(sid) {
  return request({
    url: '/bidding/bidTenderRules/findBiddingRuleBySid/' + sid,
    method: 'get'
  })
}

export function addTenderQuotation(data) {
  return request({
    url: '/bidding/tenderQuotation',
    method: 'post',
    data: data
  })
}

export function findBiddingList(sid) {
  return request({
    url: '/bidding/tenderQuotation/findList/' + sid,
    method: 'get'
  })
}

export function findProcurementPlan(aid) {
  return request({
    url: '/ppm/plan/' + aid,
    method: 'get'
  })
}

//结束竞价
export function updateUKaiEndTime(sid) {
  return request({
    url: '/bidding/notice/updateUKaiEndTime/' + sid,
    method: 'put'
  })
}

//延时竞价
export function updateByUKaiEndTime(data) {
  return request({
    url: '/bidding/notice/updateByUKaiEndTime',
    method: 'post',
    data: data
  })
}

